<?php
namespace Home\Controller;
use Think\Controller;
class ActivityController extends CommonController {
    public function act_detail(){
    	if(I('id')){
    		session('look_aid',I('id'));//记录当前浏览的活动ID，注册或登录成功后将跳往此处
	    	$id = I('id');
	    	$act = M('activity')->where(array('id'=>$id))->find();
			$this->assign('act',$act);
			$this->meta_title = $act['title'];
			$cooper = M('activity_cooper')->where(array('aid'=>$id))->select();
			$changdi_cooper = M('activity_cooper')->where(array('aid'=>$id,'type'=>1))->select();
			$hezuo_cooper = M('activity_cooper')->where(array('aid'=>$id,'type'=>2))->select();
			$this->cooper = $cooper;//活动的合作信息
			$this->changdi_cooper = $changdi_cooper;
			$this->hezuo_cooper = $hezuo_cooper;
			
			$act_event = M('activity_event')->where(array('uid'=>$this->uid,'aid'=>$id))->find();
			if($act_event['status']){//如果是已经报名过，则取消报名
				$this->want = '<button class="btn btn-danger want-btn" id="cancle">取消报名</button>'.
								'<button class="btn btn-success want-btn dn" id="join">我要登台</button>';
			}else{
				$this->want = '<button class="btn btn-success want-btn" id="join">我要登台</button>';
			}
	    	$this->display();
		}else{
			$this->redirect('Index/index');
		}
    }
}